package com.qys.livesMall.shop.modal.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 采购额度账户
 * </p>
 *
 * @author
 * @since 2023-09-15
 */
@Getter
@Setter
@TableName("h2_shop_purchase_account")
@Schema(name = "ShopPurchaseAccount", description = "采购额度账户")
public class ShopPurchaseAccount implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "用户id")
    private Long userId;

    @Schema(description = "店铺id")
    private Long shopId;

    @Schema(description = "剩余额度")
    private BigDecimal purchaseAmount;

    @Schema(description = "总额度")
    private BigDecimal totalPurchaseAmount;

    @Schema(description = "生效月份")
    private String effectiveMonth;

    @Schema(description = "更新时间")
    private LocalDateTime updateTime;


    @Schema(description = "总使用额度")
    private BigDecimal totalUsePurchaseAmount;

    public BigDecimal getTotalUsePurchaseAmount() {
        return totalUsePurchaseAmount==null?new BigDecimal("0"):totalUsePurchaseAmount;
    }
}
